Fix mem leak, and don't pass GType as integer through gpointer. Bug
authorChristian Persch <chpe@gnome.org>
Sat, 5 Jan 2008 18:56:47 +0000 (18:56 +0000)
committerChristian Persch <chpe@src.gnome.org>
Sat, 5 Jan 2008 18:56:47 +0000 (18:56 +0000)
2008-01-05  Christian Persch  <chpe@gnome.org>

        * tests/defaultvaluetest.c: Fix mem leak, and don't pass
        GType as integer through gpointer. Bug #507395.

svn path=/trunk/; revision=19307

ChangeLog
tests/defaultvaluetest.c

index 69119dee5916d4df185a3ed49c3588577705975b..f5fb2ee583107dd4d4e451abe74c66eb2cfb3391 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-05  Christian Persch  <chpe@gnome.org>
+
+        * tests/defaultvaluetest.c: Fix mem leak, and don't pass
+        GType as integer through gpointer. Bug #507395.
+
 2008-01-04  Mathias Hasselmann  <mathias@openismus.com>
 
        Avoid some compiler warnings (#507000).
index f3c41e192bc4c070d3c42bc3b3fadd2d77dbc5a3..b36e7fb9ac034614063e3e9c0329cf5d084e9adc 100644 (file)
@@ -63,9 +63,9 @@ test_type (gconstpointer data)
   GParamSpec **pspecs;
   guint n_pspecs, i;
   GType type;
-  
-  type = GPOINTER_TO_INT (data);
-  
+
+  type = * (GType *) data;
+
   if (!G_TYPE_IS_CLASSED (type))
     return;
 
@@ -278,6 +278,7 @@ test_type (gconstpointer data)
       check_property ("Property", pspec, &value);
       g_value_unset (&value);
     }
+  g_free (pspecs);
 
   if (g_type_is_a (type, GTK_TYPE_WIDGET))
     {
@@ -299,6 +300,8 @@ test_type (gconstpointer data)
          check_property ("Style property", pspec, &value);
          g_value_unset (&value);
        }
+
+      g_free (pspecs);
     }
   
   if (g_type_is_a (type, GDK_TYPE_WINDOW))
@@ -326,7 +329,7 @@ main (int argc, char **argv)
       testname = g_strdup_printf ("/Default Values/%s",
                                  g_type_name (otypes[i]));
       g_test_add_data_func (testname,
-                           GINT_TO_POINTER (otypes[i]),
+                            &otypes[i],
                            test_type);
       g_free (testname);
     }